import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import * as serviceWorker from './serviceWorker';
import {BrowserRouter} from "react-router-dom";
import {ThemeProvider} from '@material-ui/core';
import createMuiTheme from "@material-ui/core/styles/createMuiTheme";
import RouteApp from "./App";

const getConfirmation = (message:any, callback:any) => {
    const allowTransition = window.confirm(message);
    callback(allowTransition);
};
const theme = createMuiTheme({
    props: {
        // Name of the component ⚛️
        MuiButtonBase: {
            // The default props to change
            disableRipple: true, // No more ripple, on the whole application 💣!
        },
        MuiTypography: {
            variantMapping: {
                h1: 'h1',
                h2: 'h2',
                h3: 'h3',
                h4: 'h4',
                h5: 'h5',
                h6: 'h6',
                subtitle1: 'h6',
                subtitle2: 'h6',
                body1: 'span',
                body2: 'span',
            },
        },

    },
    typography: {
        fontFamily: [
            '-apple-system',
            'BlinkMacSystemFont',
            '"Segoe UI"',
            'Roboto',
            '"Helvetica Neue"',
            'Arial',
            'sans-serif',
            '"Apple Color Emoji"',
            '"Segoe UI Emoji"',
            '"Segoe UI Symbol"',
        ].join(','),
    },
});
ReactDOM.render(
    <BrowserRouter
        basename=""
        getUserConfirmation={getConfirmation}
        keyLength={32}>
        <ThemeProvider theme={theme}>
            <RouteApp/>
        </ThemeProvider>

    </BrowserRouter>,
  document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
